import request from "@/utils/request";

/**
 * 上传文件
 */
export function uploadFileApi(data, source) {
  return request({
    url: `/file/upload`,
    method: "post",
    headers: { "Content-Type": "multipart/form-data" },
    data,
    params: {
      source: source,
    },
  });
}

/**
 * 删除文件
 */
export function deleteFileApi(url) {
  return request({
    url: `/file/delete`,
    method: "get",
    params: {
      url,
    },
  });
}

/**
 * 导入Markdown文档
 */
export function importMarkdownApi(data) {
  return request({
    url: `/file/import-markdown`,
    method: "post",
    headers: { "Content-Type": "multipart/form-data" },
    data,
  });
}

/**
 * 下载Markdown模板
 */
export function downloadMarkdownTemplateApi() {
  return request({
    url: `/file/markdown-template`,
    method: "get",
    responseType: "blob",
  });
}
